FortiGate 50E にOpenWrtをインストールする
FortiGate 50EにOpenWrtをインストールする手順
用意するもの
Dockerとbashがうごくパソコン
USBイーサネットアダプタ
パソコンに空いているイーサネットポートがある場合は、それを使ってもよい
LANケーブル
2本
全体の手順の確認
シリアルコンソールからブートローダーのコマンドラインにアクセスする
TFTPからinitramfsイメージを起動する
起動したinitramfsイメージ上で、sysupgradeを使用して、sysupgradeイメージを焼く
ブラウザからアクセスしてLuCIにアクセスできることを確認する
initramfsイメージの取得
以下のページを開く
https://firmware-selector.openwrt.org/?target=mvebu%2Fcortexa9&id=fortinet_fg-50e
KERNELと書いてあるボタンを押す
sysupgradeイメージのURLの取得
以下のページを開く
https://firmware-selector.openwrt.org/?target=mvebu%2Fcortexa9&id=fortinet_fg-50e
SYSUPGRADEボタンを右クリックしてリンクをコピーして、どこかに控えておく
シリアルコンソールへの接続
電源を切る
コンソールケーブルをCONSOLEポートに挿す
CISCOのコンソールケーブルと同じものが使える
以下のコマンドを実行する
code:sh
screen /dev/ttyUSB0
デバイス名はコンソールケーブルや環境によって違うことがある
電源をいれる
Please wait for OS to boot, or press any key to display configuration menu.. と出てきたらすかさずEnterキーを押す
Enter C,R,T,F,I,B,Q,or H: というのが出てきていたら、ブートローダーのコンソールにはいれている
60秒経つと勝手に起動がはじまるので注意
TFTPの設定
設定内容の確認
Enter C,R,T,F,I,B,Q,or H: というプロンプトが出ているのを確認して、キーボードからRを入力する
以下のように設定内容が表示される
code:txt
Image download port: WAN1
DHCP status: Disabled
Local VLAN ID: <NULL>
Local IP address: 192.168.1.188
Local subnet mask: 255.255.255.0
Local gateway: 192.168.1.254
TFTP server IP address: 192.168.1.168
Firmware file name: image.out
ここで表示されるネットワークアドレス(この例だと 192.168.1.0/24)が、現在使用中のどのネットワークアドレスともかぶっていなければ、特に設定を変える必要はない
パソコンのネットワークアダプタの設定
パソコンにUSBイーサネットアダプタを接続する
50EのTFTPの設定内容に応じて、パソコンに接続したUSBイーサネットアダプタのIPアドレスを設定する
https://scrapbox.io/files/68a0daf53eb8bc1639d16d7a.png
イーサネットケーブルの接続
TFTPの設定のImage download port:に表示されているポートと、USBイーサネットアダプタをイーサネットケーブルで接続する
この例だと、Image download port: WAN1 になっているので、WAN1にケーブルを挿す
FTPサーバの起動
openwrt-mvebu-cortexa9-fortinet_fg-50e-initramfs-kernel.binをカレントディレクトリに置いたうえで、以下のコマンドを実行する
code:sh
docker run --rm -p 69:69/udp -v "$(pwd)"/openwrt-mvebu-cortexa9-fortinet_fg-50e-initramfs-kernel.bin:/tftpboot/image.out:ro jumanjiman/tftp-hpa
メモ
https://hub.docker.com/r/jumanjiman/tftp-hpa/
tftp-hpaはDebianプロジェクト推奨のTFTPサーバらしいので、割と安心して使える
initramfsの起動
code:txt
Please connect TFTP server to Ethernet port 'WAN1'.
MAC: 70:4c:a5:ac:3a:16
Connect to tftp server 192.168.1.168 ...
############
Image Received.
Checking image... OK
Save as Default firmware/Backup firmware/Run image without saving:D/B/R?
R を押すとTFTPからイメージの読み込みが開始される
initramfsイメージの起動確認
1分ほど待ったあと、Enterキーを押す
以下のようにロゴが表示されたあと、シェルのプロンプトが表示されればOK
code:txt
BusyBox v1.36.1 (2025-06-23 20:40:36 UTC) built-in shell (ash)
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
-----------------------------------------------------
OpenWrt 24.10.2, r28739-d9340319c6
-----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:~#
イーサネットケーブルの繋ぎ変え
WAN1をインターネットに出られるLANに接続する
LAN1とUSBイーサネットアダプタをイーサネットケーブルで接続する
sysupgradeの実行
initramfsが起動したら、50Eのシェルで次のコマンドを実行する
code:sh
sysupgrade -v -n https://downloads.openwrt.org/releases/24.10.2/targets/mvebu/cortexa9/openwrt-24.10.2-mvebu-cortexa9-fortinet_fg-50e-squashfs-sysupgrade.bin
起動確認
STAランプの点滅が終わるまで待つ
http://192.168.1.1/ にアクセスして、LuCIのログイン画面が表示されたら成功
https://scrapbox.io/files/68a0e19d18d05a11b2f08b40.png
Usernameにrootをいれるとログインできる
ログイン後、Status画面が表示されればLuCIは正常に機能している
https://scrapbox.io/files/68a0e1e923ca4ef4015ecbbf.png
メモ
基本的には以下の記事のとおり
Fortinet FortiGate 50E - 大破ログ
詰まったところ
ipアドレスの設定
https://zenn.dev/takashiaihara/scraps/e7ee4f988682c0
家のルータに繋ぐのはLAN1の方
firewall
wanからssh
https://www.srchack.org/article.php?story=20120218134824706
おまけ: ブートローダーのメニュー
ブートメニュー
code:txt
FortiGate-50E (17:37-01.31.2017)
Ver:05000016
Serial number: FGT50E3U17043203
CPU(00): 1600MHz
Total RAM: 2GB
Initializing boot device...
Initializing MAC... egiga1
Please wait for OS to boot, or press any key to display configuration menu..
C: Configure TFTP parameters.
R: Review TFTP parameters.
T: Initiate TFTP firmware transfer.
F: Format boot device.
I: System information.
B: Boot with backup firmware and set as default.
Q: Quit menu and continue to boot.
H: Display this list of options.
Enter C,R,T,F,I,B,Q,or H:
Rを押すと現在のTFTPサーバの設定が確認できる
Review TFTP parameters
code:txt
Image download port: WAN1
DHCP status: Disabled
Local VLAN ID: <NULL>
Local IP address: 192.168.1.188
Local subnet mask: 255.255.255.0
Local gateway: 192.168.1.254
TFTP server IP address: 192.168.1.168
Firmware file name: image.out
Enter C,R,T,F,I,B,Q,or H:
Configure TFTP parameters
code:txt
P: Set firmware download port.
D: Set DHCP mode.
I: Set local IP address.
S: Set local subnet mask.
G: Set local gateway.
V: Set local VLAN ID.
T: Set remote TFTP server IP address.
F: Set firmware file name.
E: Reset TFTP parameters to factory defaults.
R: Review TFTP parameters.
N: Diagnose networking(ping).
Q: Quit this menu.
H: Display this list of options.
Enter P,D,I,S,G,V,T,F,E,R,N,Q,or H:
N を押すとpingなどがおこなえる